package top.jle.wx.proxy.util;


public class GlobalThreadLocalUtil {

    private static final ThreadLocal<String> AccessTokenLocal = ThreadLocal.withInitial(()->null);
    private static final ThreadLocal<String> AppIdLocal = ThreadLocal.withInitial(()->null);
    private static final ThreadLocal<String> SecretLocal = ThreadLocal.withInitial(()->null);

    public static void setAccessToken(String accessToken) {
        AccessTokenLocal.set(accessToken);
    }

    public static String getAccessToken() {
        return AccessTokenLocal.get();
    }

    public static void setAppId(String appId) {
        AppIdLocal.set(appId);
    }

    public static String getAppId() {
        return AppIdLocal.get();
    }

    public static void setSecret(String secret) {
        SecretLocal.set(secret);
    }

    public static String getSecret() {
        return SecretLocal.get();
    }

    public static void clearAll(){
        AccessTokenLocal.remove();
        AppIdLocal.remove();
        SecretLocal.remove();
    }
}
